package com.software.graduationproject.modules.sys.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.software.graduationproject.commons.enums.LogType;
import com.v2coding.mybatis.model.BaseModel;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
 * SysLog : 系统日志
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_log")
@ApiModel(value = "SysLog", description = "系统日志")
public class SysLog extends BaseModel<SysLog> {

    @TableField("user_code")
    @ExcelProperty(value = "用户编码")
    @ApiModelProperty(value = "用户编码")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户编码不能为空")
    private String userCode;

    @TableField("user_name")
    @ExcelProperty(value = "用户姓名")
    @ApiModelProperty(value = "用户姓名")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户姓名不能为空")
    private String userName;

    @TableField("request_ip")
    @ExcelProperty(value = "请求IP")
    @ApiModelProperty(value = "请求IP")
    private String requestIp;

    @TableField("request_url")
    @ExcelProperty(value = "请求URL")
    @ApiModelProperty(value = "请求URL")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "请求URL不能为空")
    private String requestUrl;

    @TableField("request_action")
    @ExcelProperty(value = "请求功能")
    @ApiModelProperty(value = "请求功能")
    private String requestAction;

    @TableField("request_method")
    @ExcelProperty(value = "请求方式")
    @ApiModelProperty(value = "请求方式")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "请求方式不能为空")
    private String requestMethod;

    @TableField("request_params")
    @ExcelProperty(value = "请求参数")
    @ApiModelProperty(value = "请求参数")
    private String requestParams;

    @TableField("response_time")
    @ExcelProperty(value = "响应时间")
    @ApiModelProperty(value = "响应时间")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "响应时间不能为空")
    private Long responseTime;

    @TableField("response_status")
    @ExcelProperty(value = "响应状态码")
    @ApiModelProperty(value = "响应状态码")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "响应状态码不能为空")
    private Integer responseStatus;

    @TableField("client_device")
    @ExcelProperty(value = "终端设备")
    @ApiModelProperty(value = "终端设备")
    private String clientDevice;

    @TableField("client_platform")
    @ExcelProperty(value = "终端类型")
    @ApiModelProperty(value = "终端类型")
    private String clientPlatform;

    @TableField("client_system")
    @ExcelProperty(value = "终端类型")
    @ApiModelProperty(value = "终端类型")
    private String clientSystem;

    @TableField("client_program")
    @ExcelProperty(value = "终端类型")
    @ApiModelProperty(value = "终端类型")
    private String clientProgram;

    @TableField("client_vendor")
    @ExcelProperty(value = "终端类型")
    @ApiModelProperty(value = "终端类型")
    private String clientVendor;

    @TableField("log_type")
    @ExcelProperty(value = "日志类型")
    @ApiModelProperty(value = "日志类型")
    private LogType logType;

    @TableField("tenant_id")
    @ExcelProperty(value = "租户ID")
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;

}